|
1
|
|
|
/** |
|
2
|
|
|
* This file is part of the O2System Venus UI Framework package. |
|
3
|
|
|
* |
|
4
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
5
|
|
|
* file that was distributed with this source code. |
|
6
|
|
|
* |
|
7
|
|
|
* @author Steeve Andrian Salim |
|
8
|
|
|
* @copyright Copyright (c) Steeve Andrian Salim |
|
9
|
|
|
*/ |
|
10
|
|
|
// ------------------------------------------------------------------------ |
|
11
|
|
|
|
|
12
|
|
|
import * as $ from 'jquery'; |
|
13
|
|
|
import 'jquery-steps/build/jquery.steps.js'; |
|
14
|
|
|
import 'jquery-validation'; |
|
15
|
|
|
import Swal from 'sweetalert2'; |
|
16
|
|
|
/** |
|
17
|
|
|
* Class Wizard |
|
18
|
|
|
* |
|
19
|
|
|
* @author Teguh Rianto |
|
20
|
|
|
* @package Components |
|
21
|
|
|
*/ |
|
22
|
|
|
|
|
23
|
|
|
export default class Wizard { |
|
24
|
|
|
constructor() { |
|
25
|
|
|
//WIZARD |
|
26
|
|
|
$(".tab-wizard").steps({ |
|
27
|
|
|
headerTag: "h6", |
|
28
|
|
|
bodyTag: "section", |
|
29
|
|
|
transitionEffect: "fade", |
|
30
|
|
|
titleTemplate: '<span class="step">#index#</span> #title#', |
|
31
|
|
|
labels: { |
|
32
|
|
|
finish: "Submit" |
|
33
|
|
|
}, |
|
34
|
|
|
onFinished: function (event, currentIndex) { |
|
|
|
|
|
|
35
|
|
|
Swal("Form Submitted!", "Success"); |
|
36
|
|
|
|
|
37
|
|
|
} |
|
38
|
|
|
}); |
|
39
|
|
|
|
|
40
|
|
|
|
|
41
|
|
|
var form = $(".validation-wizard").show(); |
|
42
|
|
|
|
|
43
|
|
|
$(".validation-wizard").steps({ |
|
|
|
|
|
|
44
|
|
|
headerTag: "h6", |
|
45
|
|
|
bodyTag: "section", |
|
46
|
|
|
transitionEffect: "fade", |
|
47
|
|
|
titleTemplate: '<span class="step">#index#</span> #title#', |
|
48
|
|
|
labels: { |
|
49
|
|
|
finish: "Submit" |
|
50
|
|
|
}, |
|
51
|
|
|
onStepChanging: function (event, currentIndex, newIndex) { |
|
52
|
|
|
return currentIndex > newIndex || !(3 === newIndex && Number($("#age-2").val()) < 18) && (currentIndex < newIndex && (form.find(".body:eq(" + newIndex + ") label.error").remove(), form.find(".body:eq(" + newIndex + ") .error").removeClass("error")), form.validate().settings.ignore = ":disabled,:hidden", form.valid()) |
|
|
|
|
|
|
53
|
|
|
}, |
|
54
|
|
|
onFinishing: function (event, currentIndex) { |
|
|
|
|
|
|
55
|
|
|
return form.validate().settings.ignore = ":disabled", form.valid() |
|
|
|
|
|
|
56
|
|
|
}, |
|
57
|
|
|
onFinished: function (event, currentIndex) { |
|
|
|
|
|
|
58
|
|
|
Swal("Form Submitted!", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed lorem erat eleifend ex semper, lobortis purus sed."); |
|
59
|
|
|
} |
|
60
|
|
|
}), |
|
61
|
|
|
$(".validation-wizard").validate({ |
|
62
|
|
|
ignore: "input[type=hidden]", |
|
63
|
|
|
errorClass: "text-danger", |
|
64
|
|
|
successClass: "text-success", |
|
65
|
|
|
highlight: function (element, errorClass) { |
|
66
|
|
|
$(element).removeClass(errorClass) |
|
67
|
|
|
}, |
|
68
|
|
|
unhighlight: function (element, errorClass) { |
|
69
|
|
|
$(element).removeClass(errorClass) |
|
70
|
|
|
}, |
|
71
|
|
|
errorPlacement: function (error, element) { |
|
72
|
|
|
error.insertAfter(element) |
|
73
|
|
|
}, |
|
74
|
|
|
rules: { |
|
75
|
|
|
email: { |
|
76
|
|
|
email: !0 |
|
77
|
|
|
} |
|
78
|
|
|
} |
|
79
|
|
|
}); |
|
80
|
|
|
} |
|
81
|
|
|
} |
This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.